﻿#ifndef JSONCONFIG_H
#define JSONCONFIG_H

#include <QObject>

#include "datastruct.h"

class JsonConfig
{
public:
    JsonConfig();

    QString version() const;
    QString deviceId() const;
    QString hardwareVersionCmd() const;
    QString softwareVersionCmd() const;
    QString realtimePositionCmd() const;
    QString zeroCmd() const;
    QString centerCmd() const;
    int centerPosition() const;
    int gpioReset() const;
    int gpioResetLatch() const;
    QList<FixedChannel> fixedChannelList() const;
    double plotXSize() const;
    double plotYMin() const;
    double plotYMax() const;
    GraphProperty graphProperty(const QString& id) const;
    int reportLevel1RowCount() const;
    int reportLevel2RowCount() const;

    QMap<QString, VideoPlayback> playbackMap(const QString& type) const;

private:
    void readConfig(const QString& filename);

private:
    // 版本, 设备编号
    QString m_version;
    QString m_deviceId;
    // 硬件版本, 软件版本
    QString m_hardwareVersionCmd;
    QString m_softwareVersionCmd;
    // 实时位置读取指令
    QString m_realtimePositionCmd;
    // 启动回原点指令
    QString m_zeroCmd;
    // 运行到中心的绝对位置
    QString m_centerCmd;
    int m_centerPosition;
    // 复位和复位封锁
    int m_gpioReset;
    int m_gpioResetLatch;
    // 固定通道
    QList<FixedChannel> m_fixedChannelList;
    // 曲线的X轴默认大小, Y轴默认范围, 颜色属性表
    double m_plotXSize;
    double m_plotYMin;
    double m_plotYMax;
    QMap<QString, GraphProperty> m_graphPropertyMap;

    // 视频播放控制
    QMap<QString, VideoPlayback> m_onePlaybackMap;
    QMap<QString, VideoPlayback> m_twoPlaybackMap;
    QMap<QString, VideoPlayback> m_threePlaybackMap;
    QMap<QString, VideoPlayback> m_fourPlaybackMap;
};

#endif // JSONCONFIG_H
